//
// Created by xili on 2024/8/4 19:41.
// Go big or go home.
//
#include <iostream>

using namespace std;

class Solution {
public:
    bool detectCapitalUse(string word) {
        //第二个小写，全小写
        //第二个大写，全大写
        int n = word.size();
        if (n < 2) {
            return true;
        }
        bool flag = isupper(word[1]);
        if (flag && islower(word[0])) {
            return false;
        }
        for (int i = 2; i < n; i++) {
            if (isupper(word[i]) ^ flag) {
                return false;
            }
        }
        return true;
    }
};